#include <jni.h>
#include <string>
#include <android/log.h>

const char *TAG = "JNI";
jboolean iscopy = true;

extern "C"
jstring
Java_example_fxa_com_demo_MainActivity_stringFromJNI(
        JNIEnv *env,
        jobject, jstring res) {
    const char *reschars = env->GetStringUTFChars(res, &iscopy);
    __android_log_write(ANDROID_LOG_INFO, TAG, reschars);
    std::string hello = "Hello";
    hello.append(reschars);
    return env->NewStringUTF(hello.c_str());
}

extern "C"
jfloat Java_example_fxa_com_demo_MainActivity_plus(JNIEnv *env, jobject, jfloat a,jfloat b){
    __android_log_write(ANDROID_LOG_INFO, TAG, "plus");
    return a + b;
}

extern "C"
jfloat Java_example_fxa_com_demo_MainActivity_minus(JNIEnv *env,
                                                   jobject, jfloat a,jfloat b){
    __android_log_write(ANDROID_LOG_INFO, TAG, "minus");
    return a - b;
}

extern "C"
jfloat Java_example_fxa_com_demo_MainActivity_divide(JNIEnv *env,
                                                   jobject, jfloat a,jfloat b){
    __android_log_write(ANDROID_LOG_INFO, TAG, "divide");
    return a / b;
}

extern "C"
jfloat Java_example_fxa_com_demo_MainActivity_multiplication(JNIEnv *env,
                                                   jobject, jfloat a,jfloat b){
    __android_log_write(ANDROID_LOG_INFO, TAG, "multiplication");
    return a * b;
}


